#include "../sean.cpp"

int fn()
{
	int n, ii;
	int x, y;
	vector<double> px, py;
	double rx, ry;
	scanf("%d", &n);
	if(n == 0)
		return 1;

	scanf("%d %d", &x, &y);
	rx = x, ry = y;

	for(ii = 0; ii < n; ii++)
	{
		scanf("%d %d", &x, &y);
		px.push_back(x);
		py.push_back(y);
	}

	printf("%d\n", PnPoly(rx, ry, px, py) != 0);

	return 0;
}

int main()
{
	while(!fn());
	return 0;
}
